<template>
    <view>
  <view class="my_page">
    <div class="userInfo">
    <uni-list>
      <uni-list-item :title="name" :note="phone" showArrow
        :thumb="avatar" thumb-size="lg" />
    </uni-list>
    </div>
     <view class="menu-list">
   <!--    <view class="list-cell list-cell-arrow" @tap="messageList">
         <view class="menu-item-box">
           <view class="iconfont icon-community menu-icon"></view>
           <view>消息中心</view>
         </view>
       </view> -->
       <view class="list-cell list-cell-arrow" @tap="toMyDevices">
         <view class="menu-item-box">
           <view class="iconfont icon-share menu-icon"></view>
           <view>我的共享</view>
         </view>
       </view>
       <view class="list-cell list-cell-arrow" @tap="myToDevices">
         <view class="menu-item-box">
           <view class="iconfont icon-share menu-icon"></view>
           <view>我收到的共享</view>
         </view>
       </view>
     </view>
  </view>
  <!--底部-->
  <nvatab :selected="index"></nvatab>
  </view>
</template>

<script>
import nvatab from '../components/tabbar/index.vue';
 import {
    getUserProfile
  } from "@/api/system/user"
export default {
  components: {
    nvatab
  },
  data() {
    return {
      index: 2,
      name:null,
      phone:null,
      userId:null
    }
  },
  onLoad() {
    getUserProfile().then(response => {
      this.name = response.data.nickName
      this.phone= response.data.phonenumber
      this.userId= response.data.userId
    })
  },
  computed: {
    avatar() {
      return this.$store.state.user.avatar
    }
  },
  methods: {
    //查询消息中心
    messageList(){
      //传参跳转到新增界面
      this.$tab.navigateTo('/devicelistpkg/myMessage/index?userId='+this.userId)
    },
    //查询我的共享
    toMyDevices(){
    //传参跳转到新增界面
    this.$tab.navigateTo('/devicelistpkg/sharePage/my_share_device?userId='+this.userId)
    },
    //查询收到的共享
    myToDevices(){
      //传参跳转到新增界面
      this.$tab.navigateTo('/devicelistpkg/sharePage/to_my_share?userId='+this.userId)
    }
  },
}
</script>

<style>
  .userInfo{
      width: 95%;
      margin: 40rpx auto;
  }
</style>